home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Unix / CNews / Source / inject / mkstripinvis < prev    next >
Encoding:
Text File  |  1993-02-19  |  990 b   |  38 lines

  1. #! /bin/sh
  2. # mkstripinvis - run once to generate $NEWSBIN/inject/stripinvis on stdout
  3. #    for inews & friends
  4.  
  5. # POLICY: strip invisible chars? wrong for Kanji.
  6. # generate program to strip invisible chars, a la B news.
  7. #    bells & escapes are *right* out.
  8.  
  9. cat <<'!'                # common header
  10. #! /bin/sh
  11. # stripinvis - strip invisible characters, a la B news (for local postings).
  12. #    bells & escapes are *right* out.
  13. # POLICY: strip invisible chars? wrong for Kanji.
  14. # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  15. . ${NEWSCONFIG-/usr/lib/news/bin/config}
  16. export NEWSCTL NEWSBIN NEWSARTS NEWSPATH NEWSUMASK NEWSMASTER NEWSCONFIG
  17. PATH=$NEWSCTL/bin:$NEWSPATH; export PATH
  18.  
  19. !
  20.  
  21. # deduce which tr we have: v6 or v7
  22. case "` echo B | tr A-Z a-z `" in
  23. b)                        # a hit
  24.     cat <<'!'
  25. exec tr -d '\1-\7\13\15-\37'            # v7
  26. !
  27.     ;;
  28. B)                        # a miss
  29.     cat <<'!'
  30. exec tr -d '[\1-\7]\13[\15-\37]'        # v6 (or System V)
  31. !
  32.     ;;
  33. *)                        # gun exploded in our face
  34.     echo "$0: your tr is from neither v6 nor v7, sorry" >&2
  35.     exit 1
  36.     ;;
  37. esac
  38.